import React from 'react'
import { withRouter } from 'react-router-dom'
import './style.css'

const navMap = {
    '/': '程序员小石-商店',
    '/cart': '购物车'
}

class Header extends React.Component {
    render() {
        const { location } = this.props
        return (
            <div className='header'>
                <div className='img'>
                    <img src="https://xinglong.tech/logo.jpg" />
                </div>
                <h1>
                    {navMap[location.pathname]}
                </h1>
            </div>
        )
    }
}

export default withRouter(Header)
